/*
 * cpu_card.h
 *
 *  Created on: Oct 16, 2025
 *      Author: Lenovo
 */

#ifndef FM17660K_CPU_CARD_H_
#define FM17660K_CPU_CARD_H_

typedef struct
{
    unsigned int    SendLength;
    unsigned char   *pSendBuffer;
    unsigned char    ReceiveLength;
    unsigned char   *pReceiveBuffer;
        unsigned int Timeout;
}transmission_struct;

struct ATS_STR
{
    unsigned char   Length;
    unsigned char   Ats_Data[255];
};
struct PPS_STR
{
    unsigned char   Length;
    unsigned char   Pps_Data[1];
};

struct CPU_CARD_STR
{
    unsigned char   FSCI;
    unsigned char   FSC;
    unsigned char   FWI;
    unsigned int    FWT;
    unsigned char   SFGI;
    unsigned char   TA;
    unsigned char   TB;
    unsigned char   TC;
    unsigned char   PCB;
    unsigned char   WTXM;
    struct ATS_STR  ATS;
    struct PPS_STR  PPS;
};

typedef struct {
uint8_t head[2];
uint8_t TotalLen;
uint8_t seidCode;
uint8_t seidLen;
uint8_t seidData[32];
}SeidRespApduDef;


extern struct CPU_CARD_STR CPU_CARD;
extern unsigned char Ats_Process( unsigned char ats_len, unsigned char *ats );

extern unsigned char CPU_CARD_EVENT( unsigned char uid_seid[10] );
extern unsigned char CPU_TPDU( transmission_struct *tpdu );

extern unsigned char CPU_Rats( unsigned char *ats_len, unsigned char *ats );


extern unsigned char CPU_NAK( transmission_struct *tpdu );


extern unsigned char CPU_APDU( transmission_struct *apdu );


extern unsigned char CPU_TPDU( transmission_struct *tpdu );

#endif /* FM17660K_CPU_CARD_H_ */
